﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using BEX.Core;

namespace BEX.DataAccess
{
    public class CurrencyDAL
    {
        /*
        public static Currency GetByID(int id)
        {

            var _context = new BTCDataClassesDataContext();


            var _r = (from acc in _context.GetTable<EXCHANGE>()
                      where (acc.ID == id)
                      select acc).ToList<EXCHANGE>();


            Exchange res = null;

            if (null != _r && _r.Count > 0)
            {

                res = new Exchange();
                res.ID = _r[0].ID;
                res.Name = _r[0].NAME;
                res.QueryFrequency = _r[0].QUERY_FREQUENCY;
                res.TickerURL = _r[0].TICKER_URL;

                var _pairs = (from acc in _context.GetTable<EXCHANGE_CURRENCY>()
                              where (acc.EXCHANGE_ID == res.ID)
                              select acc).ToList<EXCHANGE_CURRENCY>();

                if (null != _pairs && _pairs.Count > 0)
                {
                    for (int i = 0; i < _pairs.Count; ++i)
                    {
                        CurrencyPair _new = new CurrencyPair();
                        _new.Base = (CurrencyType)_pairs[i].BASE_CURRENCY_ID;
                        _new.Counter = (CurrencyType)_pairs[i].COUNTER_CURRENCY_ID;

                        res.CurrencyPairs.Add(_new);

                    }

                }
            }


            return res;
        }*/
    }
}
